<?php

namespace Modules\Slider\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SliderRequest extends FormRequest
{
    //验证规则
    public function rules()
    {
    	$id=$this->route ('slider');
        return array (
        	'title'=>'required|unique:sliders,title,'.$id,
			'isshow'=>'required',
			'thumb'=>'required'
		);
    }

    //错误信息处理
    public function messages()
    {
        return array (
        	'title.required'=>'标题不能为空',
			'title.unique'=>'标题已存在',
			'isshow.required'=>'请选择是否显示',
			'thumb.required'=>'请选择缩略图'
);
    }

    //权限验证
    public function authorize()
    {
        return true;
    }
}
